﻿namespace Agile.Service.Admin.WebApi.Controllers;

/// <summary>
/// 系统菜单服务接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class SysMenuController : AgileControllerBase
{
    /// <summary> 添加菜单 </summary> 
    [HttpPost]
    public async Task<ResponseResult<bool>> Insert(InsertSysMenuRequest request)
    => Result(await this.GetService<ISysMenuService>().InsertAsync(request));

    /// <summary> 修改菜单 </summary> 
    [HttpPost]
    public async Task<ResponseResult<bool>> Update(UpdateSysMenuRequest request)
    => Result(await this.GetService<ISysMenuService>().UpdateAsync(request));

    /// <summary> 删除菜单 </summary> 
    [HttpGet]
    public async Task<ResponseResult<bool>> Remove(long menuID)
    => Result(await this.GetService<ISysMenuService>().RemoveAsync(menuID));

    /// <summary> 查询菜单 </summary> 
    [HttpPost]
    public async Task<ResponseResult<List<QuerySysMenuResponse>>> Query(QuerySysMenuRequest request)
    => Result(await this.GetService<ISysMenuService>().QueryAsync(request));

    /// <summary> 查询登录用户菜单 </summary> 
    [HttpGet]
    public async Task<ResponseResult<List<QueryLoginUserMenuResponse>>> QueryLoginUserMenu()
    => Result(await this.GetService<ISysMenuService>().QueryLoginUserMenuAsync());

    /// <summary> 查询权限设置菜单 </summary> 
    [HttpGet]
    public async Task<ResponseResult<List<QueryPowerMenuResponse>>> QueryPowerMenu()
    => Result(await this.GetService<ISysMenuService>().QueryPowerMenuAsync());
}
